package L5;
import java.io.FileReader;
import java.io.File;
import java.io.FileOutputStream;
import java.util.Arrays;
import java.util.Scanner;


public class ImgDecoder {
    public static void main(String[] args) {
        int count = 0;
        try (Scanner sc = new Scanner(new File(".\\src\\L5\\Img.raw"));FileOutputStream img = new FileOutputStream(".\\src\\L5\\Img.png")) {
            while (sc.hasNext()) {
                String byteValue = sc.next();
                Integer value = Integer.decode(byteValue);
                img.write(value);
                ++count;
            }
            System.out.println(count);
        } catch (Exception e) {
           System.out.println(e);
        }      
    } 
}
